package com.tokenplus.thai.earn.rules

import android.annotation.SuppressLint
import android.view.View
import androidx.lifecycle.ViewModel
import androidx.recyclerview.widget.LinearLayoutManager
import com.tokenplus.thai.R
import com.tokenplus.thai.base.BaseActivity
import com.tokenplus.thai.databinding.ActivityTransferEarnRulesBinding
import com.tokenplus.thai.earn.rules.adapter.DataEarnRules
import com.tokenplus.thai.enums.PageTagEnum
import com.tokenplus.thai.extend.*
import com.tokenplus.thai.earn.rules.adapter.EarnRulesAdapter

/** 规则页 */
@SuppressLint("CustomSplashScreen")
class TransferEarnRulesActivity : BaseActivity() {

    //布局binding
    private lateinit var mActivityBinding: ActivityTransferEarnRulesBinding

    //适配器
    private lateinit var mTransferRulesAdapter: EarnRulesAdapter

    override fun onBindingViewModel(): List<ViewModel> {
        val list = mutableListOf<ViewModel>()
        return list
    }

    override fun onBindingViewTag(): String {
        return PageTagEnum.my_wallet.name.uppercase()
    }

    override fun onBindingContentView(): View {
        mActivityBinding =
            ActivityTransferEarnRulesBinding.inflate(layoutInflater)
        return mActivityBinding.root
    }

    override fun onContentViewBinded() {
        try {
            //初始化适配器
            val list = mutableListOf<DataEarnRules>()
            list.add(DataEarnRules(rule = getString(R.string.transfer_rules_1)))
            list.add(DataEarnRules(rule = getString(R.string.transfer_rules_2)))
            list.add(DataEarnRules(rule = getString(R.string.transfer_rules_3)))
            list.add(DataEarnRules(rule = getString(R.string.transfer_rules_4)))
            list.add(DataEarnRules(rule = getString(R.string.transfer_rules_5)))
            list.add(DataEarnRules(rule = getString(R.string.transfer_rules_6)))
            list.add(DataEarnRules(rule = getString(R.string.transfer_rules_7)))
            list.add(DataEarnRules(rule = getString(R.string.transfer_rules_8)))
            list.add(DataEarnRules(rule = getString(R.string.transfer_rules_9)))

            mTransferRulesAdapter = EarnRulesAdapter(list)

            mActivityBinding.listTransferRules.layoutManager = LinearLayoutManager(this)
            mActivityBinding.listTransferRules.adapter = mTransferRulesAdapter

        } catch (e: Exception) {
            e.printStackTrace()
        }
    }

}